package com.nms.handler;

import com.nms.dao.SystemInfoDao;
import com.nms.dao.impl.SystemInfoDaoImpl;
import com.nms.model.pojo.SystemInfo;

public class SystemInfoHandler {

	private SystemInfoDao systemInfoDao;
	private static SystemInfoHandler handler;
	static {
		handler = new SystemInfoHandler();
	}
	private SystemInfoHandler(){
		systemInfoDao = new SystemInfoDaoImpl();
	}
	public static SystemInfoHandler getInstance(){
		return handler;
	}
	/////////////////////////////////////////////////////
	/**
	 * 将系统信息复制到sInfo中
	 * @param sInfo
	 */
	public void copySystemInfo(SystemInfo sInfo){
		sInfo.setFreeMemory(getFreeMemory());
		sInfo.setOsArch(getOsArch());
		sInfo.setOsName(getOsName());
		sInfo.setOsVersion(getOsName());
		sInfo.setRuntimeName(getRuntimeName());
		sInfo.setRuntimeVersion(getRuntimeVersion());
		sInfo.setSunArch(getSunArch());
		sInfo.setTmpDir(getTmpDir());
		sInfo.setTotalMemory(getTotalMemory());
		sInfo.setUserDir(getUserDir());
		sInfo.setUserName(getUserName());
		sInfo.setVmName(getVmName());
		sInfo.setVmVersion(getVmVersion());
	}
	/////////////////////////////////////////////////////
	
	public SystemInfoDao getSystemInfoDao() {
		return systemInfoDao;
	}

	public void setSystemInfoDao(SystemInfoDao systemInfoDao) {
		this.systemInfoDao = systemInfoDao;
	}

	public String getOsName() {
		return systemInfoDao.getOsName();
	}

	public String getOsVersion() {
		return systemInfoDao.getOsVersion();
	}

	public String getOsArch() {
		return systemInfoDao.getOsArch();
	}

	public String getSunArch() {
		return systemInfoDao.getSunArch();
	}

	public String getUserName() {
		return systemInfoDao.getUserName();
	}

	public String getUserDir() {
		return systemInfoDao.getUserDir();
	}

	public String getTmpDir() {
		return systemInfoDao.getTmpDir();
	}

	public String getRuntimeName() {
		return systemInfoDao.getRuntimeName();
	}

	public String getRuntimeVersion() {
		return systemInfoDao.getRuntimeVersion();
	}

	public String getVmName() {
		return systemInfoDao.getVmName();
	}

	public String getVmVersion() {
		return systemInfoDao.getVmVersion();
	}

	public Float getFreeMemory() {
		return systemInfoDao.getFreeMemoery();
	}

	public Float getTotalMemory() {
		return systemInfoDao.getTotalMemory();
	}

}
